home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / Visual Cafe Pro v1.0 / TUTORIAL.BIN / ExceptionList.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-01-30  |  2.7 KB  |  68 lines

  1. package symantec.itools.db.net;
  2.  
  3. import java.io.DataInputStream;
  4. import java.io.DataOutputStream;
  5. import java.io.IOException;
  6. import java.util.Vector;
  7. import symjava.sql.SQLException;
  8.  
  9. class ExceptionList extends ServerObject {
  10.    // $FF: renamed from: _e symjava.sql.SQLException
  11.    SQLException field_0;
  12.  
  13.    ExceptionList(SQLException e) {
  14.       this.field_0 = e;
  15.    }
  16.  
  17.    ExceptionList() {
  18.       this.field_0 = new SQLException("");
  19.    }
  20.  
  21.    SQLException getSQLException() {
  22.       return this.field_0;
  23.    }
  24.  
  25.    int getType() {
  26.       return 68;
  27.    }
  28.  
  29.    void read(DataInputStream in) throws SQLException, IOException, ErrorException {
  30.       in.readShort();
  31.       byte[] leader = new byte[4];
  32.       in.readFully(leader, 0, 4);
  33.       ServerObject obj = (ServerObject)NetClass.getNextObject(in);
  34.       this.field_0 = null;
  35.  
  36.       for(SQLException eLast = this.field_0; obj.getType() == 49; obj = (ServerObject)NetClass.getNextObject(in)) {
  37.          NetError error = (NetError)obj;
  38.          SQLException eCurrent = error.toSQLException();
  39.          if (this.field_0 == null) {
  40.             eLast = eCurrent;
  41.             this.field_0 = eCurrent;
  42.          } else {
  43.             eLast.setNextException(eCurrent);
  44.             eLast = eCurrent;
  45.          }
  46.       }
  47.  
  48.       if (obj.getType() != 50) {
  49.          ((ServerObject)this).onObjectError(obj);
  50.       }
  51.  
  52.    }
  53.  
  54.    void write(DataOutputStream out) throws IOException {
  55.       out.writeByte(this.getType());
  56.       out.writeShort(4);
  57.       out.writeBytes("ERR}");
  58.       Vector eList = new Vector();
  59.  
  60.       for(SQLException eCurrent = this.field_0; eCurrent != null; eCurrent = eCurrent.getNextException()) {
  61.          eList.addElement(new NetError((byte)0, eCurrent.getErrorCode(), ((Throwable)eCurrent).getMessage(), eCurrent.getSQLState(), "", "{ERR"));
  62.       }
  63.  
  64.       ServerList list = new ServerList(eList);
  65.       list.write(out);
  66.    }
  67. }
  68.